package cn.edu.hqu.cst.lingshou03.controller;

import org.springframework.web.bind.annotation.*;

import cn.edu.hqu.cst.lingshou03.model.Order;
import cn.edu.hqu.cst.lingshou03.service.OrderService;

@RestController
@RequestMapping("/api")
public class OrderController {
    private final OrderService orderService;
    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }
    @PostMapping
    public String createOrder(@RequestBody Order order) {
        return orderService.createOrder(order);
    }
    @PutMapping("/{id}")
    public void updateOrderStatus(@PathVariable Long id, @RequestParam String status) {
        orderService.updateOrderStatus(id, status);
    }
    @GetMapping
    public String getOrders() {
        // 获取订单列表的逻辑
        return "This is a list of orders";
    }

}
